package factorytest.iflytek.com.einkiflytekfactorytest.device;

import factorytest.iflytek.com.einkiflytekfactorytest.config.EinkProperty;

public enum DeviceAttr {

    iflytek("iflytek"),
    jezetek("jezetek"),//九州9.7寸项目，没有HALL开关，没有HOME按键，没有电磁笔。有 SD卡和前光，前光又有冷光和暖光两种
    jezetek103("jezetek103"),//九洲10.3寸项目，没有HALL开关，没有电磁笔

    ;
    private final String customer;

    DeviceAttr(String customer) {
        this.customer = customer;
    }

    public String getCustomer() {
        return customer;
    }

    //是否有HallKey
    public boolean hasHallKey() {
        switch (this) {
            case jezetek:
            case jezetek103:
                return false;
            case iflytek:
            default:
                return true;
        }
    }

    //是否有HallKey
    public boolean hasHomeKey() {
        switch (this) {
            case jezetek:
                return false;
            case jezetek103:
            case iflytek:
            default:
                return true;
        }
    }

    //是否有backKey
    public boolean hasBackKey() {
        switch (this) {
            case jezetek103:
                return true;
            case jezetek:
            case iflytek:
            default:
                return false;
        }
    }

    //是否有电磁笔
    public boolean hasETP() {
        switch (this) {
            case jezetek:
            case jezetek103:
                return false;
            case iflytek:
            default:
                return true;
        }
    }

    //是否有前灯
    public boolean hasForeLight() {
        switch (this) {
            case jezetek:
                return true;
            case jezetek103:
            case iflytek:
            default:
                return false;
        }
    }

    //是否有Sdcard
    public boolean hasTFCard() {
        switch (this) {
            case jezetek:
//                return true;
            case jezetek103:
            case iflytek:
            default:
                return false;
        }
    }

    //是否有蓝牙
    public boolean hasBluetooth() {
        return true;
    }

    //是否有蓝牙录音
    public boolean hasBluetoothRecord() {
        switch (this) {
            case iflytek:
                return true;
            case jezetek103:
            case jezetek:
            default:
                return false;
        }
    }


    public static DeviceAttr getRunningDeviceAttr() {
        DeviceAttr attr = iflytek;
        final String customer = EinkProperty.getDeviceCustomer();
        for (DeviceAttr deviceAttr : DeviceAttr.values()) {
            if (deviceAttr.getCustomer().equalsIgnoreCase(customer)) {
                attr = deviceAttr;
                break;
            }
        }
        return attr;
    }
}
